package com.yonyou.train;

import java.util.HashMap;
import java.util.Map;

public class ResultJson {
    public static Map map = new HashMap<>();

    /**
     * 请求成功返回
     */
    public static Message success(Integer code, String message, Object data) {

        Message msg = new Message(code, message, data);
        return msg;
    }

    public static Message success(Integer code, String message) {
        Message msg = new Message(code, message);
        return msg;
    }

    public static Message error(Integer code, String message) {
        Message msg = new Message(code, message);
        return msg;
    }
    public static Map err(String message) {
       Map map = new HashMap();
       map.put("code",StatusCode.ERROR);
       map.put("msg",message);
        return map;
    }
    public static Map sucs(String message) {
        Map map = new HashMap();
        map.put("code",StatusCode.SUCCESS);
        map.put("msg",message);
        return map;
    }
    public static Map success(Object data, String auth) {
        map.put("data", data);
        map.put("auth", auth);
        map.put("code",200);
        map.put("msg","success");
        return (map);
    }
}
